import { getEnterpriseDetail } from '@/api/asset/enterprise.js'

// 订单是否是手动维护订单
export const orderIsMaintenance = (orderInfo = {}) => {
  const { orderSource, channelOrderMaintenance } = orderInfo
  // 渠道订单
  if (orderSource == 2) {
    return channelOrderMaintenance == 2
  } else {
    // 线下订单均为手动维护订单
    return true
  }
}

// 铁行渠道并且是自动维护的订单
export const orderIsTiexing = (orderInfo = {}) => {
  return !orderIsMaintenance(orderInfo) && orderInfo.channelType == -3
}

// 查询芝麻免押是否开启
export const getDepositShow = async () => {
  try {
    const res = await getEnterpriseDetail()
    if (res.code === 200) {
      return res.result // 直接返回结果
    }
  } catch (error) {
    return null // 返回 null 以避免 undefined
  }
}
